<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<meta name="author" content="" />
<link rel="stylesheet" href="../../css/main.css" type="text/css" />
<link href="../../css/themes/default.css" rel="stylesheet" type="text/css"/>
<link href="../../css/themes/mac_os_x.css" rel="stylesheet" type="text/css"/>
<link href="../../css/themes/alphacube.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../js/prototype.js"></script>
<script type="text/javascript" src="../../js/scriptaculous.js"></script>
<script type="text/javascript" src="../../js/page.js"></script>
<script type="text/javascript" src="../../js/window.js"></script>
<script type="text/javascript" src="../../js/window_effects.js"></script>
<script type="text/javascript">
var win;
var messages = new Array('', 'News inserita con successo', 'News cancellata con successo', 'News modificata con successo');
var index = 0;
<?php 
if(isset($_REQUEST['msg'])){
?>
index = <?php print $_REQUEST['msg'] ?>;
<?php } ?>
function news(id){
    win = new Window({className: "mac_os_x", url: "dettaglio_news.php?offset=<?php print $offset ?>&id="+id,  width:550, height:330, zIndex: 100, resizable: true, title: "Dettaglio news", showEffect:Effect.Appear, hideEffect: Effect.Fade, draggable:true, wiredDrag: true});
	win.showCenter(false);
}

</script>
<title>Registro elettronico</title>
</head>
<body <?php if(isset($_REQUEST['msg'])) print("onload='openInfoDialog(messages[".$_REQUEST['msg']."], 2)'") ?>>
	<div id="header">
		<div class="wrap" style="text-align: center">
			<?php include "../header.php" ?>
		</div>
	</div>
	<div class="wrap">
	<div id="main" style="background-color: #FFFFFF; padding-bottom: 30px; width: 100%">
	<table class="admin_table">
            <tr>
                <td class="admin_title_row" colspan="3">Elenco News: pagina <?php print $page ?> di <?php print $pagine ?></td>
            </tr>
            <tr>
                <td style="width: 65%" class="adm_titolo_elenco">Titolo</td>
                <td style="width: 15%" class="adm_titolo_elenco">Utente</td>
                <td style="width: 20%; text-align: center" class="adm_titolo_elenco">Data e ora Inserimento</td>
            </tr>
            <tr class="admin_row">
                <td id="row_before" colspan="3"></td>
            </tr>
            <?php
            $x = 1;
            if($res_news->num_rows > $limit)
                $max = $limit;
            else
                $max = $res_news->num_rows;
            while($news = $res_news->fetch_assoc()){
            	if($x > $limit) break;
                list($data, $ora) = split(" ", $news['ora']);
            ?>
            <tr>
                <td class="admin_row<?php if($x % 2) print(" odd") ?>"><a href="#" onclick="news(<?php print $news['id_news'] ?>)"><?php print truncateString($news['abstract'], 72) ?></a></td>
                <td class="admin_row<?php if($x % 2) print(" odd") ?>"><?php print $news['nome']." ".$news['cg'] ?></td>
                <td class="admin_row _center<?php if($x % 2) print(" odd") ?>"><?php print format_date($data, SQL_DATE_STYLE, IT_DATE_STYLE, "/")." ".$ora ?></td>
            </tr>
            <?php
                $x++;
            }
            include "../../shared/navigate.php";
            ?>
            <tr class="admin_row admin_menu">
                <td colspan="3">
                    <a href="#" onclick="news('0')" style="margin-right: 10px">Nuova news</a>|
                    <a href="<?php print $_SESSION['__config__']['html_root'] ?>admin/index.php" style="margin-left: 10px">Torna menu</a>
                </td>
            </tr>
            <tr class="admin_row">
                <td colspan="3"></td>
            </tr>
        </table>
        </div>
        <div id="footer">
			<p>Design: Luka Cvrk - <a href="http://www.solucija.com" title="Free Web Templates">Solucija</a></p>
		</div>
    </div>				
</body>
</html>